package spring.aop.dao;

import org.springframework.stereotype.Repository;
import spring.aop.annotation.Victor;
import spring.aop.pojo.T1;
import spring.aop.pojo.T2;

/**
 * AOP学习: 模拟出来的目标对象
 *
 * @author ME
 * @date   2019/11/13
 */
@Repository("indexDao")
public class IndexDaoImpl implements IndexDao {

    @Override
    public void query1() {
        System.out.println("  IndexDaoImpl: Execute indexDao.query1()");
    }

    @Override
    public void query2(Integer i) {
        System.out.println("  IndexDaoImpl: Execute indexDao.query2(Integer i)");
    }

    @Override
    public void queryByStr(String str) {
        System.out.println("  IndexDaoImpl: Execute indexDao.query3(String str)");
        System.out.println("  IndexDaoImpl: args: \"" + str + "\"");
    }

    @Override
    @Victor
    public void query4(Integer i, String str) {
        System.out.println("  IndexDaoImpl: Execute indexDao.query4(Integer i, String str)");
    }

    @Override
    public void query5(T1 t1) {
        System.out.println("  IndexDaoImpl: Execute indexDao.query5(T1 t1)");
    }

    /**
     * TODO 这种配置无效：@Victor T2 t2
     * 好像都是切面切所有方法，然后自己匹配 `Annotation[][] annotations = method.getParameterAnnotations();`
     *
     * @param t2
     */
    @Override
    public void query6(@Victor T2 t2) {
        System.out.println("  IndexDaoImpl: Execute indexDao.query6(T2 t2)");
    }
}
